home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0107_Fast Line Drawing.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  993b  |  45 lines

  1. {
  2.  SS> I'm looking for a qwick way to draw a line... All I need are
  3.  SS> horizontal and vertical lines, so would it be easiest to use a
  4.  SS> series of PutPixels?
  5.  
  6. Unfortunately you don't specify which mode you're working in, so
  7. I assume it is 320x200 (which tends to be the most popular mode here):
  8. }
  9.  
  10. Procedure DHL(x, y, Length : Word; Color : Byte); Assembler;
  11.   Asm
  12.     mov   ax,0a000h
  13.     mov   es,ax
  14.     mov   ax,y
  15.     shl   ax,6
  16.     mov   di,ax
  17.     shl   ax,2
  18.     add   di,ax
  19.     add   di,x
  20.     mov   cx,Length
  21.     mov   al,Color
  22.     cld
  23.     rep   stosb { I bet I'll get loads of replies which uses stosw instead :) }
  24.   End;
  25.  
  26. Procedure DVL(x, y, Length : Word; Color : Byte); Assembler;
  27.   Asm
  28.     mov   ax,0a000h
  29.     mov   es,ax
  30.     mov   ax,y
  31.     shl   ax,6
  32.     mov   di,ax
  33.     shl   ax,2
  34.     add   di,ax
  35.     add   di,x
  36.     mov   al,Color
  37.     mov   cx,Length
  38. @DVL1:
  39.     mov   es:[di],al
  40.     add   di,320
  41.     dec   cx
  42.     jnz   @DVL1
  43.   End;
  44.  
  45.